<?php
require_once("./includes/config.inc.php");
if($_POST){
	$email = htmlspecialchars(trim(addslashes($_POST['email'])));
	$password = htmlspecialchars(trim(addslashes($_POST['password'])));
	$sql = " SELECT * from tbl_user where email ='$email' and password='$password'  ";
	$result = executeQuery($sql);
	if ($row = mysql_fetch_array($result)){
		$_SESSION['sessLogedinUserId'] = $row['userId'];
		$_SESSION['sessCourseId'] = $row['courseId'];
		header("location: dashboard.php");
		exit();
	}else{
		$_SESSION['sessMsg'] = "Wrong Email or Password. Please try again.";
		header("location: index.php");
		exit();
	}
}
?>